<template>
	<view class="content">
		<view class="top">
			<uni-nav-bar left-icon="back" fixed="true" backgroundColor="url('/webh5/static/topbgye.png')" :title="payTitle?'提货成功':'提货失败'" color="white"
				@clickLeft="returnBack">
			</uni-nav-bar>
		</view>
		<view class="image-box flex">
			<image :src="payTitle?'/static/sybd.png':'/static/sysb.png'"></image>
		</view>
		<view class="text-result">提货{{payTitle?'成功':'失败'}}</view>
		<view class="jieshao">{{payTitle?'成功您已提货  去商城看看吧':''}}</view>
		<view class="jifen-box flex">
			<image v-if="payTitle" src="/static/icon_jifen (1).png"></image>
			<text v-if="payTitle" class="text">当前积分：{{myIntegral}}</text>
		</view>
		<view class="btn-box flex">
			<view class="btn-look" @click="goUrl">查看订单</view>
		</view>
		<view class="btn-box flex">
			<view class="btn-shop" @click="gobackIndex">前往商城</view>
		</view>
	</view>
</template>

<script>
	var _this;
	const app = getApp();
	import {
		isIphone,
		isSystem
	} from '@/utils/common.js';
	import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue'
	export default {
		components: {
			uniNavBar
		},
		data() {
			return {
				myIntegral:0,//用户的积分显示
				payTitle: false,//成功或者失败
			};
		},
		onLoad() {
			_this = this;
			_this.getUserInfo();
			_this.getResult();
			if(isSystem()=='Iphone'){
				_this.$api.msg("该机型是ios");
			}
		},
		onShow() {},
		methods:{
			gobackIndex() {
				var system=isSystem();
				if(system=='Iphone'){
					// returnIndex();
					let parameter = {
						"className":"IntegralMallHomeVC",
						"order":0,
						"property":{"isReturn":1}
					};
					console.log(parameter)
					window["webkit"].messageHandlers.actionAsPhp.postMessage(parameter);
				}
				if(system=='Android'){
					window["liveapp"].openPointsMall("1");
					// uni.reLaunch({
					// 	url: '/pages/index/index'
					// });
				}
			},
			returnBack() {
				// #ifdef H5
				const pages = getCurrentPages()
				if (pages.length > 1) {
					uni.navigateBack(1)
					return;
				}
				//使用vue-router返回上一级
				let a = this.$router.go(-1)
				if (a == undefined) {
					//重新定向跳转页面
					uni.reLaunch({
						url: "/pages/index/index"
					})
				}
				return;
				// #endif
				uni.navigateBack(1)
			},
			goUrl() {
				var system=isSystem();
				if(system=='Iphone'){
					let parameter = {"className":"IntegralMallOrderDetailVC"};
					window["webkit"].messageHandlers.actionAsPhp.postMessage(parameter);
				}
				if(system=='Android'){
					window["liveapp"].openPointsMallOrderList();
				}
			},
			getUserInfo(){
				_this.$HTTP({
					method: 'GET',
					url: 'fjStoreMember/getUserInfo',
					data: {
						"time": Date.parse(new Date())
					},
					// header:'form' 
				}).then(res => {
					if (res.data) {
						_this.myIntegral=res.data.balance;
					}
				}).catch(err => {
					console.log(err)
				})
			},
			getResult(){
				_this.$HTTP({
					method: 'GET',
					url: 'fjStoreOrder/getOrderPaid',
					data: {
						"time": Date.parse(new Date())
					},
					// header:'form' 
				}).then(res => {
					if (res.data) {
						_this.payTitle = res.data.resultType;
					}
				}).catch(err => {
					console.log(err)
				})
			}
		}
	}
</script>
<style lang="less">
	page {
		width: 100%;
		background: white;
	}
</style>
<style scoped lang="less">
	.top {
		width: 100%;
	}
	.content {
		width: 100%;
		.image-box{
			width: 100%;
			justify-content: center;
			margin-top: 180rpx;
			image{
				width: 186rpx;
				height: 186rpx;
			}
		}
		.text-result{
			width: 100%;
			text-align: center;
			font-size: 40rpx;
			font-weight: 400;
			color: #111111;
			margin-top: 19rpx;
		}
		.jieshao{
			width: 100%;
			text-align: center;
			font-size: 32rpx;
			font-weight: 400;
			color: #111111;
			margin-top: 60rpx;
		}
		.jifen-box{
			width: 100%;
			margin-top: 20rpx;
			justify-content: center;
			align-items: center;
			image{
				width: 44rpx;
				height: 44rpx;
			}
			.text{
				font-size: 32rpx;
				font-weight: 400;
				color: #666666;
				margin-left: 2rpx;
			}
		}
		.btn-box{
			width: 100%;
			justify-content: center;
			.btn-look{
				width: 520rpx;
				height: 80rpx;
				line-height: 80rpx;
				text-align: center;
				font-size: 28rpx;
				font-weight: 400;
				color: #FFFFFF;
				background: url('~@/static/矩形 1351.png');
				background-size: 100% 100%;
				margin-top: 350rpx;
			}
			.btn-shop{
				width: 520rpx;
				height: 80rpx;
				line-height: 80rpx;
				text-align: center;
				font-size: 28rpx;
				font-weight: 400;
				color: #7B7BFF;
				background: url('~@/static/矩形 1351 (1).png');
				background-size: 100% 100%;
				margin-top: 30rpx;
			}
		}
	}
</style>
